package com.logic.landseaserver.service;


import java.util.HashMap;
import java.util.List;

import com.logic.common.exception.BusinessException;
import com.logic.common.service.ICRUDService;
import com.logic.landseaserver.common.exception.LandseaBusinessException;
import com.logic.landseaserver.common.exception.LandseaException;
import com.logic.landseaserver.domain.*;
import com.logic.landseaserver.models.authcode.bean.UsedAuthCode;
import com.logic.landseaserver.ws.dto.BillDetailAndPayDTO;
import com.logic.landseaserver.ws.dto.BillSelectAllDTO;
import com.logic.landseaserver.ws.dto.CurrentBillDTO;
import com.logic.landseaserver.ws.dto.UserBillDTO;
import com.logic.landseaserver.ws.request.ContractNeedDelReq;
import com.logic.landseaserver.ws.request.CurrentBillReq;

/**
 * @Author: jack
 * @Date: 2017/5/4
 * @Description: 账单接口类
 */
public interface IBillService extends ICRUDService {

    /**
     * 根据合同id查询当前账单
     *
     * @param pmap
     * @return
     * @throws BusinessException
     */
    List<BillSelectAllDTO> getBillByCurrent(HashMap pmap) throws BusinessException;

    void createFirstBill(Integer contractId, List<UsedAuthCode> authCodes) throws Exception;

    /**
     * 给合同编辑调用，根据合同id查询支付状态：部分支付返回true，未支付返回false，全部支付返回：true
     *
     * @param contractId
     * @return
     * @throws BusinessException
     */
    Boolean getBillStatusForId(Integer contractId) throws BusinessException;

    /**
     * 给微众收银台调用，支付成功查询支付状态：部分支付返回false，未支付返回false，全部支付返回：true
     *
     * @param contractId
     * @return
     * @throws BusinessException
     */
    Boolean getBillStatusForContractId(Integer contractId) throws BusinessException;

    Bill changeBillStatus(Integer billId, Double currentPayMoney) throws BusinessException;

    List<CurrentBillDTO> getBillInfoByCurrent(CurrentBillReq req) throws BusinessException;

    List<UserBillDTO> getBillList(CurrentBillReq req) throws LandseaBusinessException;

    CurrentBillDTO getBillDetail(Integer billId) throws LandseaBusinessException;

    List<CurrentBillDTO> queryBillList(CurrentBillReq req) throws LandseaBusinessException;

    void createMonthBill() throws LandseaException;

    BillDetailAndPayDTO queryBillDetailAndPayList(Integer billId) throws LandseaBusinessException;

    //根据合同号取账单月
    void deleteNoPayBill(List<ContractNeedDelReq> list);

    void posPayCallBackHandle(PosPaymentCallback posPaymentCallback)
            throws LandseaException;

    void createLateFee();

    void createOffRentBill(PreOffrentBill preBill, List<PreOffrentDetailBill> details)throws LandseaException;

    /**
     * 退款后账单操作
     * @param refund
     * @throws LandseaException
     */
    void billCuteAfterConfirm(Refund refund)throws LandseaException;

    void  delayOffBillSendMsg()throws LandseaException;

    void deleteNoPay(Integer contractId);

    void createMonthBillByContractId(Integer contractId) throws LandseaException;

    Bill queryFirstBill(Integer contractId)throws  LandseaException;

    void sendMsgByMonthBill(HashMap map)throws  LandseaException;

    void addAuthCode(Object object) throws LandseaException, BusinessException, Exception;

    void deleteBill(Integer billId);

    BillDetail convertPreDetailToBillDetail(PreOffrentDetailBill preDtBill);

    /**
     * 续租合同首期款有其他费项则需将A合同其余费项更改为已支付
     * @param contractId
     */
    void updateMontlyOrgContract(Integer contractId,Integer billId);

    Bill queryLastBill(Integer contractId);
    
    void createFirstBill4ChangeRoom(Contract contract, List<UsedAuthCode> authCodes) throws LandseaException;

    String checkBillPay(Integer contractId) throws  LandseaException;

    void createMonthBillByCIds(String ids) throws LandseaException;

    void changeBill(Integer id)throws LandseaException;
}
